<template>
	<div class="home">
		<home-header></home-header>
		<home-swiper :list="swiperList"></home-swiper>
		<home-icons></home-icons>
		<home-like :list="likeList"></home-like>
	</div>
</template>
<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeLike from './components/Like'

import { mapState } from 'vuex'

import axios from 'axios'
export default {
	name: "Home",
	data(){
		return {
			nowCity: this.$store.state.city,
			swiperList: [],
			likeList: []
		}
	},
	methods: {
		getHomeInfo() {
			axios.get(`/api/home.json?city=${this.city}`).then(res => {
				const data = res.data
				//console.log(data)
				if(data.ret){
					this.swiperList = data.data.swiperList;
					this.likeList = data.data.likeList;
				}
			})
		}
	},
	created() {
		this.getHomeInfo()
	},
	components: {
		HomeHeader,
		HomeSwiper,
		HomeIcons,
		HomeLike
	}
}
</script>
<style lang="scss" scoped>
	.home{
		background-color: #f5f5f5;
	}
</style>

